package com.ks.core.core;


import io.swagger.annotations.ApiModelProperty;

public class ServiceResult<T> {

	@ApiModelProperty("错误代码，200表示处理正常，非0表示有问题.")
	private final int code;
	@ApiModelProperty("请求执行情况信息.")
	private final String message;
	@ApiModelProperty("版本号")
	private final String version;
	@ApiModelProperty("返回的数据.")
	private final T data;

	public ServiceResult(ResultCode resCode, T data) {
		this(resCode.getCode(), resCode.getMessage(),resCode.getVersion(), data);
	}

	public ServiceResult(int code, String message,String version, T data) {
		super();
		this.code = code;
		this.message = message;
		this.version = version;
		this.data = data;
	}

	public int getCode() {
		return code;
	}

	public String getMessage() {
		return message;
	}

	public String getVersion(){
		return version;
	}

	public T getData() {
		return data;
	}
}
